<?php
$this->breadcrumbs=array(
	Yii::t('backend','Thành viên')
);

$this->menu=array(
	array('label'=>NHtml::icon('ss_add') . Yii::t('backend','Thêm'), 'url'=>array('create')),
	array('label'=>NHtml::icon('ss_find') . Yii::t('backend','Tìm kiếm nâng cao'), 'url'=>'#', 'linkOptions'=>array('class'=>'search-button')),
	array('label'=>NHtml::icon('ss_help') . Yii::t('backend','Giúp đỡ'), 'url'=>array('')),
	array('label'=>NHtml::icon('ss_delete') . Yii::t('backend','Xóa'), 'url'=>array('')),	
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('user-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<div class="search-form hide">
	<p><?php echo Yii::t('backend','Dùng các dấu so sánh (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b> hoặc <b>=</b>) ở đầu mỗi giá trị để tùy chỉnh cách so sánh.')?></p>
	<?php $this->renderPartial('_search',array(
		'model'=>$model,
	)); ?>
</div><!-- search-form -->

<?php
$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'user-grid',
	'ajaxUpdate'=>false,
	'selectableRows'=>Yii::app()->session->get('adminPageSize',25),
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'template'=>"{summary} {pager} {items} {pager}", 
	'columns'=>array(
		'id' 			   ,
		array('name'=>'email','value'=>'CHtml::link($data->email,array("view","id"=>$data->id))','type'=>'raw'),
		'username' 		   ,
		'name' 			   ,
		'first_name'	   ,
		'last_name' 	   ,

		'avatar_path:image' ,
		'join_date:datetime' ,
		'activation_key'   ,
		'password' 		   ,
		'salt' 			   ,
		'group_id' 		   ,
		'group_ids' 	   ,
		'display_group_id' ,
		array(
			'class'=>'CButtonColumn',
			'header'=>CHtml::dropDownList(
				'perPage',
				Yii::app()->session->get('backendPageSize',25),
				Yii::app()->params['backendPageSizeOptions'],
				array(
					'ajax'=>array(
						'url'=>$this->createUrl('pageSize'),
						'context'=>'js:$(this)',
						'data'=>'js:{"pageSize":this.value}',
						'success'=>'js:function(data){
							$.fn.yiiGridView.update("blog-post-grid");
						}'
					)
				)
			)
		),
	),
));
?>
